package com.order.dao;

import com.order.pojo.Food;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
@Mapper
public interface FoodDao {
    //录入新菜(管理员)
    @Insert("INSERT INTO food(name,price) VALUES (#{name},#{price})")
    @Options(useGeneratedKeys = true, keyProperty = "id" ,keyColumn = "id")
    Integer insert(Food food);
    //查找所有菜(客户、管理员)
    @Select("SELECT * FROM food")
    List<Food> findAll();
}
